package com.example.rocketstream.temp.controller;

import com.example.rocketstream.temp.stream.StreamOutput;
import com.example.rocketstream.temp.entity.Ant;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.messaging.support.MessageBuilder;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Date;

/**
 * @author aliceblue
 * @date 20/2/19 17:54
 */
@RestController
@RequestMapping("test")
public class MQRest {

    @Autowired
    StreamOutput streamOutput;

    @GetMapping("str")
    public void str(){

        String now = "now"+"  "+new Date();
        streamOutput.SMSOutput().send(MessageBuilder.withPayload(now).build());
    }

    @GetMapping("ant")
    public void ant(){

        Ant ant = new Ant();
        ant.setSize("so big");
        streamOutput.ANTOutput().send(MessageBuilder.withPayload(ant).build());
    }
}
